export class T_return<T = any> {
    // 错误消息
    private _err!: string;
  
    // 返回对象，用在函数返回时多个对象
    public returnData?: Map<string, T>;
  
    constructor(errmsg: string = '') {
      this._err = errmsg;
      this.returnData = new Map();
    }
  
    public set errmsg(errmsg: string) {
      this._err = errmsg;
    }
  
    public get errmsg(): string {
      return this._err;
    }
  
    // 设置err 消息 输出T_error
    public error(errmsg: string): T_return<T> {
      this._err = errmsg;
      return this;
    }
  
    public isErr(): boolean {
      return !!this._err;
    }
  
    public getReturnData(key: string): T {
      return this.returnData.get(key);
    }
  
    public getReturnDataMap(): Map<string, T> {
      return this.returnData;
    }
  
    public setReturnData(key: string, value: T) {
      this.returnData.set(key, value);
    }
  }
  
  export interface I_return<T = any> extends T_return<T> {}
  